<?php
$page = 'Admin';
$in_site = 'dassnfu';
$loginVereist = true;
include($_SERVER['DOCUMENT_ROOT']."/start.php");

//Ben je wel ingelogd?
if(empty($mainClass->spelerId)) {
	include_once($_SERVER['DOCUMENT_ROOT']."/header.php");
	include_once($_SERVER['DOCUMENT_ROOT']."/sidebar.php");
	echo "<div id='main'><div id='submain'><div class='content'><div class='subcontent'>
		<div class='content_header'><h1>Admin dingetjes</h1></div>
		<div class='content_main'>";
	echo "<div class='error'><p class='icon'>Login om deze pagina te bekijken.</p></div>";
	echo "</div></div></div></div></div>";	//content_main, sub_content, content, sub_main, main
	include_once($_SERVER['DOCUMENT_ROOT']."/footer.php");
	die();
}
//Heb je wel het recht om deze pagina te bekijken?
if($mainClass->spelerId <> 2) {
	include_once($_SERVER['DOCUMENT_ROOT']."/header.php");
	include_once($_SERVER['DOCUMENT_ROOT']."/sidebar.php");
	echo "<div id='main'><div id='submain'><div class='content'><div class='subcontent'>
		<div class='content_header'><h1>Admin dingetjes</h1></div>
		<div class='content_main'>";
	echo "<div class='error'><p class='icon'>Je hebt niet het recht om deze pagina te bekijken.</p></div>";
	echo "</div></div></div></div></div>";	//content_main, sub_content, content, sub_main, main
	include_once($_SERVER['DOCUMENT_ROOT']."/footer.php");
	die();
}

//include_once($_SERVER['DOCUMENT_ROOT']."/php_functions/database_connectie.php");
include_once($_SERVER['DOCUMENT_ROOT']."/php_functions/my_query.php");
include_once($_SERVER['DOCUMENT_ROOT']."/header.php");
include_once($_SERVER['DOCUMENT_ROOT']."/sidebar.php");

echo $mainClass->showPageStart();

$myQuery->query = "SELECT spelerId, voornaam, tussenvoegsel, achternaam FROM Speler ORDER BY achternaam, voornaam, tussenvoegsel, spelerId";
$myQuery->doQuery();

if($myQuery->isValidResult()) {
	$row = $myQuery->result->fetchAll();
	echo "<p>Meld je aan als:</p>";
	echo "<select onchange='location = this.options[this.selectedIndex].value;'>";
	foreach($row  as $_row) {
		echo "<option value='/admin/aanmelden_als.php?id=".$_row['spelerId']."'>".$_row['voornaam']." ".(isset($_row['tussenvoegsel']) ? $_row['tussenvoegsel']." " : "").$_row['achternaam']."</option>";
	}
	echo "</select>";
}

echo $mainClass->showPageEnd();
include_once($_SERVER['DOCUMENT_ROOT']."/footer.php");
?>
